<template>
  <div class="c-app">
    <div class="c-app-main">
      <h1 class="c-app-h">现在是北京时间</h1>
      <h1 class="c-app-time">{{ time }}</h1>
    </div>
  </div>
</template>

<script>
const dayjs = require("dayjs");
export default {
  name: "inDex",
  data() {
    return {
      time: "",
      settime: null,
    };
  },
  created() {
    this.settime = setInterval(() => {
      this.time = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
    });
  },
  beforeDestroy() {
    if (this.settime) {
      clearInterval(this.settime);
    }
  },
};
</script>

<style scoped>
.c-app {
  /* width: calc(100vw - 261px); */
  height: 930px;
  background-color: #f0f1f5;
  padding: 20px;
}
.c-app-main {
  width: 100%;
  height: 100%;
  background-color: rgb(255, 255, 255);
}
.c-app-h {
  position: relative;
  top: 40%;
  color: rgb(102, 180, 126);
}
.c-app-time {
  position: relative;
  top: 30%;
  color: rgba(0, 0, 0, 0.515);
}
</style>